package edu.pku.sei.modeler.uml.commands.usecase;

import edu.pku.sei.modeler.model.core.MetaModelElement;
import edu.pku.sei.modeler.model.structure.MetaNode;
import edu.pku.sei.modeler.model.uml.Kernel.Classifier;
import edu.pku.sei.modeler.model.uml.UseCases.UseCase;
import edu.pku.sei.modeler.uml.commands.NestedElementDeleteCommand;
import edu.pku.sei.modeler.uml.commands.NestedPackageElementDeleteCommand;

public class NestedUseCaseDeleteCommand extends NestedElementDeleteCommand {

	public NestedUseCaseDeleteCommand(MetaNode node, MetaNode fatherNode, boolean isDeletedFromDiagram) {
		super(node, fatherNode, isDeletedFromDiagram);
	}
	
	@Override
	protected void deleteModelElement() {
		Classifier classifier = (Classifier) fatherNode.getModelElement();
		classifier.getOwnedUseCase().remove(node.getModelElement());
	}

	@Override
	protected void undoDeleteModelElement() {
		MetaModelElement modelElement = this.node.getModelElement();
		Classifier classifier = (Classifier) fatherNode.getModelElement();
		classifier.getOwnedUseCase().add(modelElement);
	}

}
